package com.bw.ustil;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

/**
 * @author admin
 * @date 2025年08月25日 19:55
 */
public class BaseDao {
    private static final BaseDao DD =new BaseDao();
    private BaseDao(){
    }
    public static BaseDao getDd(){
        return DD;
    }
    //链接数据库
    public static Connection getCon() throws SQLException, ClassNotFoundException {
        Class.forName("com.mysql.jdbc.Driver");
        return DriverManager.getConnection("jdbc:mysql://localhost:3306/day10?serverTimezone=GMT%2B8&characterEncoding=utf-8&useSSL=false","root","123456");

    }
    public static void closeAll(AutoCloseable...args) throws Exception {
        if(args!=null){
            for (AutoCloseable arg : args) {
                arg.close();
            }
        }
    }
}
